I was working on some code to work with movable modal dialogs when I realized that I didn’t know how to tell the Return key and the Enter key apart. So I wrote ShowKeyChar in a couple of hours. ShowKeyChar is a tiny application that will display the key and char codes for the last key pressed in that application.
About key and char codes
For programmers, it’s important to understand the difference between the key and char codes. The key code identifies the physical key that was pressed, and is unique to a key on the keyboard. The char is the character that a key produces, and more than one key can produce the same code. For example, a “1” on the regular keyboard and a “1” in the numeric key pad have different key codes, but the same char code. And a “1” on the regular keyboard and a “!” have the same key code, but different char codes.
Using ShowKeyChar 1.0
Using the application is easy: launch it and press a key. The first time the application is launched the window will appear in its default position. After that, the window will appear in the location it was the last time the application was quit. To quit the application, press Command-Q, select Quit from the File menu, or close its window.
Notes
I wrote this application as quickly as I could because I didn’t expect anybody else to use it. So I didn’t take the time to have it check its environment. I’m pretty sure you need System 7.5 because it uses an AppleGuide-style window (or windoid). I also didn’t want to bother supporting a separate preferences file, so the window location is stored within the application itself. If the window ever gets lost, simply delete resource of type WLOC and it will appear in the default location the next time ShowKeyChar is launched. If these are problems for anybody, let me know and I may fix them.
How to contact me
If you have comments or suggestions, or if you just want to tell me to go to hell, I can be reached at jalvarad@oboe.aix.calpoly.edu. Don’t send email to the AOL account since I only check that once or twice a month (if I don’t cancel my account) as opposed to once or twice a day for the internet account.
Disclaimer
The program ShowKeyChar is supplied “as is.” The programmer makes no guarantees and assumes no responsibility for any damage or loss of data that may result from its use.
Revision History
Version 1.0 – December 31, 1995: Original release.